package com.plian.system.service.fr.internalauditmanagement.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.plian.Tools.CollectionUtil;
import com.plian.system.entity.fr.internalauditmanagement.IamRectifyIdentifyList;
import com.plian.system.mapper.fr.internalauditmanagement.IamRectifyIdentifyListMapper;
import com.plian.system.mybatis.base.BaseServiceImpl;
import com.plian.system.service.fr.internalauditmanagement.IamRectifyIdentifyListService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 审计整改-整改认定清单(IamRectifyIdentifyList)表服务实现类
 *
 * @author jiatp
 * @since 2023-03-02 14:10:13
 */
@Service
@Slf4j
@AllArgsConstructor
public class IamRectifyIdentifyListServiceImpl extends BaseServiceImpl<IamRectifyIdentifyListMapper, IamRectifyIdentifyList> implements IamRectifyIdentifyListService {

    @Override
    public boolean deleteByAuditRectifyId(List<Long> ids) {
        LambdaUpdateWrapper<IamRectifyIdentifyList> queryWrapper = new LambdaUpdateWrapper<>();
        queryWrapper.in(IamRectifyIdentifyList::getAuditRectifyId, ids);
        List<IamRectifyIdentifyList> list = list(queryWrapper);
        if (CollectionUtil.isNotEmpty(list)) {
            return deleteLogic(list.stream().map(IamRectifyIdentifyList::getId).collect(Collectors.toList()));
        }
        return true;
    }
}

